package com.uzai.common.enums;

/**
 * 用户身份
 * @Auther: liuqi
 * @Date: 2021/8/14 16:45
 * @Description:
 */
public enum IdentityEnum {
    BUYER(1,"买家"),
    AGENT(2,"代理"),
    PARTNER(3,"合伙人");

    private Integer id;
    private String desc;

    IdentityEnum(Integer id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static IdentityEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (IdentityEnum type: IdentityEnum.values()) {
            if (type.getId().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
